import * as api from '../api/config'

const actions = {
	REQ_register({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.regIster(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	REQ_registerSms({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.registerSms(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 登陆
	REQ_loginByPwd({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.loginByPwd(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	REQ_videoListByCategory({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.videoListByCategory(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	//评论列表
	REQ_Indexcomments({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.Indexcomments(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	//评论列表
	REQ_VideoComment({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.VideoComment(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 用户详情
	REQ_UserDetail({ commit }, id) {
		return new Promise((resolve, reject) => {
			api.UserDetail(id).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},

	//绑定手机号发送验证码
	REQ_bindMobileSms({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.bindMobileSms(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 绑定手机号
	REQ_bindMobile({ commit }, data) {
		return new Promise((resolve, reject) => {
			api.bindMobile(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 签到
	REQ_signIn() {
		return new Promise((resolve, reject) => {
			api.signIn().then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 视频点赞
	REQ_videoLike({commit}, data) {
		return new Promise((resolve, reject) => {
			api.videoLike(data).then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
	// 获取邀请码
	REQ_invitationIndex({commit}) {
		return new Promise((resolve, reject) => {
			api.invitationIndex().then(response => {
				resolve(response)
			}).catch(error => {
				reject(error)
			})
		})
	},
}

export default actions